package com.suzao.rabbitmq.consumer;

import com.suzao.rabbitmq.entity.Merchant;
import org.springframework.amqp.rabbit.annotation.RabbitHandler;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.context.annotation.PropertySource;
import org.springframework.messaging.handler.annotation.Payload;
import org.springframework.stereotype.Component;

/**
 * @classname: FirstConsumer
 * @description:
 * @author: mc
 * @create: 2020-10-29 16:29
 **/
@Component
@PropertySource("classpath:rabbitmq.properties")
@RabbitListener(queues = "${com.suzao.firstqueue}" , containerFactory = "rabbitListenerContainerFactory")
public class FirstConsumer {

    @RabbitHandler
    public void process(@Payload Merchant merchant){
        System.out.println("First Queue received msg : " + merchant.getName());
    }
}
